/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jmodcog2.filter;

/**
 *
 * @author Mitchel Strachan <technotheist@gmail.com>
 */
public class SigmoidFilter extends PixelFilter {
    protected boolean bipolar;
    protected float range;

    public SigmoidFilter(int size, float range, boolean bipolar) {
        super(size);
        this.range = range;
        this.bipolar = bipolar;
    }
    
    

    @Override
    protected float _f(float x) {
        if (bipolar) {
            return -1f + 2f / (1 + exp(x/range));
        }
        return 1f / (1 + exp(x/range));
    }
}
